<!--雷达图-->
<template>
  <div class="chartcontainer" v-if="iffresh">
    <div :style="{'margin-bottom':'10px'}"  v-if="title">{{title}}</div>
    <!-- :judge-width="true" -->
    <ve-radar
      :data="blockdata"
      width="100%"
      height="100%"
      ref="mychart"
      :theme="theme"
      :judge-width="true"
      :after-config="afterConfig"
      :grid="grid"
    ></ve-radar>
  </div>
</template>

<script>
import VeRadarFall from "v-charts/lib/radar.common";

export default {
  name: "block1",
  props: {
    chartData: [Object],
    changesizewidth: [Number, String],
    changesizeheight: [Number, String],
    theme: [Object],
    title: [String],
    searchid: [String],
    chartid: [String],
    mobiletype: [String],
    field: [String],
    isShowLegend: {
      type: Boolean,
      default: true
    }
  },
  data() {
    this.chartSettings = {};
    this.grid = {
      left: 60,
      top: 40,
      right: 100,
      bottom: 120
    };
    return {
      intervaltime: this.timer,
      blockdata: this.chartData,
      iffresh: true
    };
  },

  components: { VeRadarFall },
  created() {},
  mounted() {},
  destroyed() {},
  methods: {
    afterConfig(options) {
      if (!this.isShowLegend) {
        options.legend = {
          data: []
        };
      }
      return options;
    }
  },
  watch: {
    changesizewidth(oldvalue, newvalue) {
      this.$refs.mychart.echarts.resize();
    },

    changesizeheight(oldvalue, newvalue) {
      this.$refs.mychart.echarts.resize();
    },
    chartData(oldvalue, newvalue) {
      this.blockdata = oldvalue;
    }
  }
};
</script>
<style scoped lang="scss">
.chartcontainer {
  width: 100%;
  height: 100%;
}
</style>

